#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
#include <string>
#include <unordered_map>
#include <algorithm>
using namespace std;
class Solution {
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs)
    {
        unordered_map<string, vector<string>> un_map;
        for (int i = 0;i < strs.size();++i)
        {
            string tmp = strs[i];
            sort(strs[i].begin(), strs[i].end());
            un_map[strs[i]].push_back(tmp);
        }
        vector<vector<string>> ret;
        for (const auto& a : un_map)
        {
            ret.push_back(a.second);
        }
        return ret;
    }
};